package main

import "fmt"

func main() {
	arr := []int{1, 2, 3, 4, 1}
	fmt.Println(containsDuplicate(arr))
}

func containsDuplicate(nums []int) bool {
	var b bool
	hash := make(map[int]int)
	for _, i := range nums {
		_, b = hash[i]
		if !b {
			hash[i] = i
		} else {
			return true
		}
	}
	return b
}
